package com.ziq.baselib

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ziq.base.base.BaseActivity
import com.ziq.baselib.business.post.PostingListActivity
import com.ziq.baselib.test.databinding.DataBindingActivity
import com.ziq.baselib.test.drawable.DrawableActivity
import com.ziq.baselib.test.hilt.HiltActivity
import com.ziq.baselib.test.hilt.HiltActivity2
import com.ziq.baselib.test.hilt.HiltFragmentActivity
import com.ziq.baselib.test.horizontalpage.HorizontalPageActivity
import com.ziq.baselib.test.horizontalpage.HorizontalPageActivity2
import com.ziq.baselib.test.io.IoStreamActivity
import com.ziq.baselib.test.livedata.LiveDataActivity
import com.ziq.baselib.test.toast.ToastActivity
import com.ziq.baselib.test.page.AutoRollViewPagerActivity
import com.ziq.baselib.test.page.BaseListAdapterActivity
import com.ziq.baselib.test.page.CameraActivity
import com.ziq.baselib.test.page.CameraGLActivity
import com.ziq.baselib.test.page.CustomLayoutManagerActivity
import com.ziq.baselib.test.page.HorizontalScrollViewTabActivity
import com.ziq.baselib.test.page.MediaCodecPagerActivity
import com.ziq.baselib.test.page.OpenGL2Activity
import com.ziq.baselib.test.page.OpenglActivity
import com.ziq.baselib.test.page.PasswordInputActivity
import com.ziq.baselib.test.page.PathOnDrawActivity
import com.ziq.baselib.test.page.TranslateLoadingViewActivity
import com.ziq.baselib.test.viewpager.ViewPagerActivity

class MainActivity : BaseActivity() {
    var mRecyclerView: RecyclerView? = null
    var mainRecycleViewAdapter: MainRecycleViewAdapter? = null
    var dataList: MutableList<DemoListItem> = ArrayList()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        mRecyclerView = findViewById(R.id.recycle_view)
        val linearLayoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)
        mRecyclerView!!.setLayoutManager(linearLayoutManager)
        initData()
        mainRecycleViewAdapter = MainRecycleViewAdapter(this, dataList)
        mRecyclerView!!.setAdapter(mainRecycleViewAdapter)
    }

    private fun initData() {
        dataList.add(DemoListItem("DEMO-MediaCodec", MediaCodecPagerActivity::class.java))
        dataList.add(DemoListItem("DEMO-Camera", CameraActivity::class.java))
        dataList.add(DemoListItem("DEMO-CameraGL", CameraGLActivity::class.java))
        dataList.add(DemoListItem("DEMO-OpenGl", OpenglActivity::class.java))
        dataList.add(DemoListItem("DEMO-OpenGl2", OpenGL2Activity::class.java))
        dataList.add(DemoListItem("DEMO-Canvas", PathOnDrawActivity::class.java))
        dataList.add(DemoListItem("DEMO-BaseListAdapter", BaseListAdapterActivity::class.java))
        dataList.add(DemoListItem("DEMO-MvvMActivity", PostingListActivity::class.java))
        dataList.add(DemoListItem("DEMO-DataBindingActivity 按钮", DataBindingActivity::class.java))
        dataList.add(DemoListItem("DEMO-HiltActivity", HiltActivity::class.java))
        dataList.add(DemoListItem("DEMO-HiltActivity2", HiltActivity2::class.java))
        dataList.add(DemoListItem("DEMO-HiltFragment", HiltFragmentActivity::class.java))
        dataList.add(DemoListItem("DEMO-LiveData", LiveDataActivity::class.java))
        dataList.add(DemoListItem("DEMO-Drawable", DrawableActivity::class.java))
        dataList.add(DemoListItem("DEMO-IO", IoStreamActivity::class.java))
        dataList.add(DemoListItem("DEMO-Toast", ToastActivity::class.java))
        dataList.add(DemoListItem("DEMO-HorizontalPage", HorizontalPageActivity::class.java))
        dataList.add(DemoListItem("DEMO-HorizontalPage2", HorizontalPageActivity2::class.java))
        dataList.add(DemoListItem("DEMO-ViewPager", ViewPagerActivity::class.java))


        //自定义效果
        dataList.add(DemoListItem("View-录音翻译状态控件", TranslateLoadingViewActivity::class.java))
        dataList.add(DemoListItem("View-轮播图控件", AutoRollViewPagerActivity::class.java))
        dataList.add(DemoListItem("View-水平导航栏控件", HorizontalScrollViewTabActivity::class.java))
        dataList.add(DemoListItem("View-密码输入框", PasswordInputActivity::class.java))
        dataList.add(DemoListItem("View-自定义layoutManager", CustomLayoutManagerActivity::class.java))

    }

    class DemoListItem(var name: String, var cls: Class<*>)
}